<template>
  <div id="app">
    <h1>根组件</h1>
    <span>库存总数:</span>
    <input type="number" v-model="count" />
    <Add />
    <Sub />
  </div>
</template>

<script>
import Add from "@/components/Add";
import Sub from "@/components/Sub";
export default {
  components: {
    Add,
    Sub,
  },
  computed: {
    count() {
      return this.$store.state.num;
    },
  },
};
</script>

<style>
#app {
  width: 300px;
  margin: 20px auto;
  border: 1px solid #ccc;
  padding: 4px;
}
</style>
